package tanxin;

public class Solution_121 {

    public int maxProfit(int[] prices) {
        int minNum=prices[0];
        int res=0;
        for (int i = 0; i < prices.length; i++) {
            res=Math.max(res,prices[i]-minNum);
            minNum=Math.min(prices[i],minNum);
        }
        return res;
    }
}
